package com.imooc.modular.config;

import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

/**
 * 用于注册第三方Filter
 *
 * @author yuelinbo
 * @date 2019/2/10 10:44
 **/


//@Configuration
public class WebFilterConfig extends WebMvcConfigurationSupport {

   /* @Autowired
    private TimeInterceptor timeInterceptor;*/

    /*@Bean
    public FilterRegistrationBean timeFilter() {
        FilterRegistrationBean registrationBean = new FilterRegistrationBean();
        TimeFilter timeFilter = new TimeFilter();
        List<String> urls = new ArrayList<>(10);
        urls.add("/*");  // 设置所有路径进行拦截
        registrationBean.setFilter(timeFilter);
        registrationBean.setUrlPatterns(urls);

        return registrationBean;

    }*/

    /*@Override
    protected void addInterceptors(InterceptorRegistry registry) {

        registry.addInterceptor(timeInterceptor);
    }
*/

   /* @Override
    protected void configureAsyncSupport(AsyncSupportConfigurer configurer) {

        configurer.registerCallableInterceptors(); //设置异步拦截器
        configurer.registerDeferredResultInterceptors();
        configurer.setDefaultTimeout(10000);//设置默认超时时间
    }
    */

   /* @Override
    protected void addResourceHandlers(ResourceHandlerRegistry registry) {

        registry.addResourceHandler("/static/**").addResourceLocations("classpath:/static/");

        registry.addResourceHandler("swagger-ui.html")
                .addResourceLocations("classpath:/META-INF/resources/*");

        registry.addResourceHandler("/webjars/**")
                .addResourceLocations("classpath:/META-INF/resources/webjars");

        super.addResourceHandlers(registry);
    }*/

/*

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("swagger-ui.html")
                .addResourceLocations("classpath:/META-INF/resources/");

        registry.addResourceHandler("/webjars/**")
                .addResourceLocations("classpath:/META-INF/resources/webjars/");



}
*/



   /* @Bean
    public Docket createRestApi() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo())
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.imooc.modular.controller"))
                .paths(PathSelectors.any())
                .build();
    }

    private ApiInfo apiInfo() {
        return new ApiInfoBuilder()
                .title("区块链追溯系统 后台接口文档")
                .description("")
                .termsOfServiceUrl("")
                .version("1.0")
                .build();
    }**/

}
